#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <set>
using namespace std;
bool vis[40010];
char s[40010];
set<int>mx;
int main()
{
	int m,flag;
	while(scanf("%d",&m)&&m)
	{
		flag = 0;
		scanf(" %s",s);
		int N;
		int len = strlen(s);
		printf("len = %d\n",len);
		N = len-m+1;
		while(N>=1)
		{
			printf("N=%d\n",N);
			if(!mx.empty()) mx.clear();
			memset(vis,0,sizeof(vis));	
			for(int i = 0;i+N<len;i++)
			{
				//printf("******\n");
				long long int temp=0;
				for(int j=i;j<i+N;j++)
				{
					printf("******\n");
					temp = temp*26+(s[j]-'a');
				}
				vis[temp]++;
				//mx.insert(vis[temp]);
			}
			/*int ans = *(--mx.end());
			if(ans >= m)
			{
				flag = 1;
				printf("%d %d\n",N);
				break;
			}*/
			N--;
		}
		if(!flag) printf("none\n");
		
	}
}
